/**
 * localStorage 存贮
 * 目前对象值如果是函数 、RegExp等特殊对象存贮会被忽略
 * @param {String} key  属性
 * @param {Object} value 值
 */
export const localStorageSet = (key: string, value: any) => {
  if (typeof (value) === 'object') {
    value = JSON.stringify(value);
  }
  localStorage.setItem(key, value);
};

/**
 * localStorage 获取
 * @param {String} key  属性
 */
export const localStorageGet = (key: string) => {
  return JSON.parse(localStorage.getItem(key) as string);
};

/**
 * localStorage 移除
 * @param {String} key  属性
 */
export const localStorageRemove = (key: string) => {
  localStorage.removeItem(key);
};
